
module CustomerServices (PerformedHaircut, CustomerServices, ServicesOfCustomer, emptyPerformedHaircuts, 
newPerformedHaircut, isEmptyCServices, newCustomer) where

import Customer

-- a customer service contains a haircut and a string representing additional notes
-- DUDA:Aca cambie los nombres pero estaban repetidos de los dos lados, asi como estan ahora. Esto no
-- va a chillar?
data PerformedHaircut = PerformedHaircut Haircut Notes

-- a customer with its services
data ServicesOfCustomer = CI Customer CustomerServices

type Notes = String
type Haircut = String

-- a wrapped storage structure that contains the customer services
newtype CustomerServices = CServices [PerformedHaircut]


-- creates a an empty customer service
newPerformedHaircut :: Haircut -> Notes -> PerformedHaircut
newPerformedHaircut hc notes = PerformedHaircut hc notes 


emptyPerformedHaircuts :: CustomerServices
emptyPerformedHaircuts = CServices []

isEmptyCServices :: CustomerServices -> Bool
isEmptyCServices (CServices []) = True
isEmptyCServices (CServices _) = False


addPerformedHaircut :: CustomerServices -> PerformedHaircut -> CustomerServices
addPerformedHaircut (CServices xs) cs = CServices (cs:xs)

-- Customer -> ServicesOfCustomer?
newCustomer :: Name -> ServicesOfCustomer
newCustomer name = CI (customer name) (emptyPerformedHaircuts)

-- persar una :: ServicesOfCustomer -> PerformedHaircut -> ServicesOfCustomer
addService :: ServicesOfCustomer -> Haircut -> Notes -> ServicesOfCustomer
addService (CI ctm services) hc nt = CI ctm (addPerformedHaircut services (PerformedHaircut hc nt))